package yxy.game.pm2.command.fortdefeat;

import yxy.cherry.game.base.message.MessageEmitterHandler;
import yxy.cherry.game.base.message.annotation.MessageSource;
import yxy.cherry.game.base.message.annotation.MessageType;
import yxy.game.pm2.Result;
import yxy.game.pm2.command.Command;
import yxy.game.pm2.message.FortDefeatMessage;

/** 副本过关斩将 过关斩将布阵 */
@MessageType(proto = Command.FortDefeatFormatSave, classtype = FortDefeatMessage.FortDefeatFormatSaveRequest.class)
public class CMD_FortDefeatFormatSave extends Command<FortDefeatMessage.FortDefeatFormatSaveRequest> {

	@Override
	public void execute(MessageSource messageSource, FortDefeatMessage.FortDefeatFormatSaveRequest request) {
		String playerCode = messageSource.getTag();
		// TODO 处理请求参数

		FortDefeatMessage.FortDefeatFormatSaveResponse.Builder response = FortDefeatMessage.FortDefeatFormatSaveResponse.newBuilder();

		// TODO 处理响应封装

		send(messageSource, response, Result.Success);
	}

	private void send(MessageSource messageSource, FortDefeatMessage.FortDefeatFormatSaveResponse.Builder response, Result result) {
		response.setResult(result.packResult());
		MessageEmitterHandler.getInstance().send(messageSource, response.build());
	}
}